package com.hardson.toolkit.listcomparator;

public class ListComparatorFactory {

	public static final <T> ListComparator<T> getListComparator(final int dataType) {

		switch (dataType) {
		case ListComparator.DATATYPE_STRING:
			return new StringListComparator<>();
		case ListComparator.DATATYPE_DOUBLE:
			return new NumberListComparator<>();
		case ListComparator.DATATYPE_DATE:
			return new DateListComparator<>();
		case ListComparator.DATATYPE_CHINESE:
			return new ChineseListComparator<>();
		default:
			return new DefaultListComparator<>();
		}
	}

	public static final <T> ListComparator<T> getListComparator(final int dataType, final String colName,
			final int order) {

		switch (dataType) {
		case ListComparator.DATATYPE_STRING:
			return new StringListComparator<T>(colName, order);
		case ListComparator.DATATYPE_DOUBLE:
			return new NumberListComparator<T>(colName, order);
		case ListComparator.DATATYPE_DATE:
			return new DateListComparator<T>(colName, order);
		case ListComparator.DATATYPE_CHINESE:
			return new ChineseListComparator<T>(colName, order);
		default:
			return new DefaultListComparator<T>(colName, order);
		}
	}
}
